package zuwotest;

import java.util.HashMap;
import java.util.Map;

import org.junit.Test;

import cn.diancan.util.HttpClientHelper;

public class T {

    public static String downloadPath="d:/cmakxmn/";
    
    @Test
    public void test1(){
	HttpClientHelper httpClient =new HttpClientHelper();
	
	String image="http://dh.sznr100.com/images/goods/20151219/129beef2cd83f53c.jpg";
	try {
	    Map<String,String> param = new HashMap<String,String>();
	    Map<String,String> headers = new HashMap<String,String>(); 
	    
	     
	    //headers.put("Accept","text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8");
	   // headers.put("Accept-Encoding", "gzip, deflate, sdch");
	   // headers.put("Accept-Language", "zh-CN,zh;q=0.8");
	   // headers.put("Cache-Control", "max-age=0");
	    headers.put("Connection", "keep-alive");
	    headers.put("Cookie", "S[CART_COUNT]=0; safedog-flow-item=7672B4DE16700D8EFD586257FC795C2A; S[loginName]=JMHS1198; CNZZDATA83419804=cnzz_eid%3D4552453-1464269229-http%253A%252F%252Fdh.sznr100.com%252F%26ntime%3D1464867065; CNZZDATA1258705718=321665695-1464272558-http%253A%252F%252Fdh.sznr100.com%252F%7C1464864384; S[L_RANDOM_CODE]=1192265fb31ab52a6332c561ee6e5258; IISSafeDogLGSession=9389A7523A77E21957C7BD139FA3F394");
	    headers.put("Host", "dh.sznr100.com");
	    headers.put("Referer", "http://dh.sznr100.com/");
	    headers.put("Upgrade-Insecure-Requests", "1");
	    headers.put("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36");
	    
	    httpClient.doGetDownLoadFile(image, param, headers, image.replaceAll("http://", downloadPath));
	    //httpClient.doGetDownLoadFile("http://movie.yichengshi.cn/upload/movie/4028817e47ddfa6d0147ddfbe6090029.jpg", null, null, "D:/upload/movie/4028817e47ddfa6d0147ddfbe6090029.jpg");
	} catch (Exception e) { 
	    e.printStackTrace();
	}
	
    }
    
    @Test
    public void test2(){
	try {
	    HttpClientHelper httpClient =new HttpClientHelper();
	    Map<String,String> headers = new HashMap<String,String>(); 
	    headers.put("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36");
	    
	    httpClient.doGet("http://dh.sznr100.com/?product-3902.html", null, headers);
	} catch (Exception e) {
	    // TODO Auto-generated catch block
	    e.printStackTrace();
	}
	//101.231.249.202
    }
    
    
      
}
